package com.medical.doctor.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.medical.doctor.controller.vo.WallentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.medical.doctor.entity.DoctorWalletEntity;
import com.medical.doctor.service.DoctorWalletService;
import com.medical.common.utils.PageUtils;
import com.medical.common.utils.R;



/**
 * 
 *
 * @author wen
 * @email 1023076426@qq.com
 * @date 2021-08-22 19:08:56
 */
@RestController
@RequestMapping("doctor/doctorwallet")
public class DoctorWalletController {
    @Autowired
    private DoctorWalletService doctorWalletService;

    /**
     * 医生钱包
     */
    @RequestMapping("/list/{id}")
    public R list(@PathVariable Integer id, @RequestBody WallentVo vo){
        vo.setDoctorId(id);
        R r = doctorWalletService.findById(vo);
        return r;
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		DoctorWalletEntity doctorWallet = doctorWalletService.getById(id);

        return R.ok().put("doctorWallet", doctorWallet);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody DoctorWalletEntity doctorWallet){
		doctorWalletService.save(doctorWallet);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody DoctorWalletEntity doctorWallet){
		doctorWalletService.updateById(doctorWallet);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		doctorWalletService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
